<?php
  class dv extends add_module{  	private $class="dv";
  	private $func="id";

  	  function _id_standby(){         $page=$this->_call_out_func("tree","_return_info",array());
         $arg['text']=$this->model->get_doc(1);
        if(!empty($page) && !empty($arg['text'])){         foreach($arg['text'] as $key=>$value)
   		 {$value['names']="Root";
         $data.=$this->view->view("templates/site/tpl_module/dv/dv.tpl",$value+$this->lang,true);
         }         return $data;
        }
  	   }

   		function id($name){   		 $id=$this->model->get_info("id","ns_tree","name",$name);
   		 $arg['text']=$this->model->get_doc($id);   		 $side=$this->model->get_info("side","ns_tree","id",$id);
   		 $data[$side]=$this->_call_out_func("tree","return_menu",$name,$side);
   		 foreach($arg['text'] as $key=>$value)
   		 {$value['names']=$name;
         $data[$value['side_for_doc']].=$this->view->view("templates/site/tpl_module/dv/dv.tpl",$value+$this->lang,true);
         }   		return	$data;
   		}

   		protected function _edit($id,$lang){   			$data['side']=$this->model->returnSide();   			$data['doc']=$this->model->getDoc($id,$lang);         return $this->view->view("templates/admin_modules/dv/edit/edit.tpl",$data+$this->lang,true);
   		}

   		function _create($lastid,$post){   		$data['lang_arr']=$this->_call_out_func("lang","return_all_lang_array",array());
   		$data['lastInsert']=$this->_call_out_func("lang","return_last_Ilang",array());   		$data['id']=$this->model->insert($this->func,$lastid,$this->class,$data['lang_arr'],$data['lastInsert']['id']);         $data['side']=$this->model->returnSide();   		 return $this->view->view("templates/admin_modules/dv/create/create.tpl",$data+$this->lang,true);
   		}

   		function _update($id){   		$this->security($_POST,"",200);   		$this->model->update($id);
   		header("location: /".ADMIN_DIR."/message/ok");
   		}

   		function _del($id,$lang=""){   		$this->model->del($id,$lang);
   		}


   		function __call($method, $params){   		return $this->show_404($method, $params);
   		}

   		function show($name,$id){   		 $ids=$this->model->get_info("id","ns_tree","name",$name);
   		 $side=$this->model->get_info("side","ns_tree","id",$ids);
   		 $data[$side]=$this->_call_out_func("tree","return_menu",$name,$side);         $doc['title']=$this->model->get_doc_title($id);
         $doc['text']=$this->model->get_text($id);
         $data[$doc['text']['side_for_doc']]=$this->view->view("templates/site/tpl_module/dv/show.tpl",$doc,true);
         return $data;
   		}

   		function _returnPath($module,$func,$link){          return $module."/".$link;
   		}

   		function _returnNLink($id){         return $this->model->get_text($id);
   		}

   		function _returnLink($id,$lang){   		return $this->model->get_text2($id,$lang);
   		}





  }
?>